package com.sright.bcard.common.service.share.enums;

/**
 * 素材及对应类型ID枚举
 */
public enum MaterialTypeSimpleEnum {
    BACKGROUND("card_media", 1),
    CORPORATE("corporate_video", 4),
    VERTICAL("vertical_video", 6),
    HORIZONTAL("horizontal_video", 8);
    // 成员变量
    private String name;
    private int index;

    // 构造方法
    MaterialTypeSimpleEnum(String name, int index) {
        this.name = name;
        this.index = index;
    }

    // 普通方法
    public static String getName(int index) {
        for (MaterialTypeSimpleEnum c : MaterialTypeSimpleEnum.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    public static Integer getIndex(String name) {
        for (MaterialTypeSimpleEnum c : MaterialTypeSimpleEnum.values()) {
            if (c.getName().equals(name)) {
                return c.index;
            }
        }
        return null;
    }

    // get set 方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
